home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
batmn21e.zip
/
BATMAN.DOC
next >
Wrap
Text File
|
1990-12-01
|
25KB
|
837 lines
│
│ B A T M A N 2 . 1 e
│
│ - a batch file
│ compiler
│
│ Thor Ivar Ekle 1989, 90
│
WHAT IS BATMAN?
───────────────
Batman is a utility for compiling batch files, or, in other words,
translating .BAT-files into .EXE-files. There are two reasons why you
might to bother with this; first, .EXE-files usually execute much
faster than .BAT-files. Secondly, batch files are normal text files,
which means that they can be printed on a screen or printer, whereas
.EXE-files are unreadable to anyone but a PC. Besides, Batman adds a
lot of functionality which the DOS batch language lacks.
This version of Batman is free. You may make as many copies as you
like, and please feel free to give away copies of the program. You may
not, however, sell part or whole of this package. All distribution of
Batman is to done by means of the file BATMN21E.ZIP, which shall
contain these files:
BATMAN.EXE - the compiler.
ROBIN.DAT - data file used by Batman.
BATMAN.DOC - this file.
BATNEWS.TXT - summary of the latest news in Batman.
TRACY.EXE - interactive debugger.
TRACY.DOC - documentation for Tracy.
COLORS.EXE - utility which displays the available color codes.
EXCOM.EXE - utility which reports how external commands are
executed.
GCD.EXE - utility which displays the directory tree and lets
you change the current directory.
MEXEC.EXE - utility which lets you select files and pass them as
arguments to a specified command.
Should you have any questions regarding Batman, please feel free to
call me at +47-7-518621.
USING BATMAN
────────────
The command for starting Batman is:
BATMAN [/A] [/C] [/D] <batch file>
The parameter <batch file> is the name of the .BAT-file you wish to
compile.
Options:
/A: If there already exists a file by the same name as the
batch file with the extension .EXE, Batman will normally ask
you to confirm that it should be replaced before compilation
starts. Also, the message "Done - press <─┘" is displayed
after Batman has completed a successful compilation. These two
messages are omitted if this option is selected. This is
useful for automatic compilations.
/C: This option forces Batman to always use COMMAND.COM for
execution of external commands. See the section "External
Commands" for more information.
/D: Use this option if you wish to debug the program file with
the interactive debugger Tracy. See the documentation for
Tracy for more information.
You may include a full path in <batch file> if the desired file isn't
located in the current directory. You may omit the extension ".BAT",
but other extensions are not accepted. Batman will search for the
requested file, and display an error message if it can't be found.
If found, a new file with the same name, but with the extension ".EXE"
will be created. If such a file already exists, you will be asked to
confirm that it should be overwritten and replaced by the new file. The
resulting .EXE-file will be stored in the same directory as the
batch file.
During compilation, the file ROBIN.DAT must be available. This file is
not required by the compiled program file.
The batch file may contain most DOS commands, plus, of course, Batman's
internal commands. The internal commands are:
BELL
────
Produces a beep. Useful for alerting the user when a time-consuming
task has completed.
CALL
────
This command is used to execute other compiled batch files. The format
is:
CALL <filename>
When you compile a batch file which contains CALL-commands, Batman will
display a list of the referenced batch files after compilation has
completed. This is to remind you to compile these files as well before
trying to run the program file.
The procedure for calling uncompiled batch files is described in a
later section.
CLOCK
─────
Displays a clock on the screen. Formats:
CLOCK ON <column> <line> <foreground color> <background color>
CLOCK OFF
The form CLOCK ON displays the current time on the screen in the
desired location and in the chosen colors. CLOCK OFF stops the clock,
but does not remove the last displayed time.
CLREOL
──────
Blanks the current line, starting with the cursor position.
CLS
───
Blanks the whole screen.
COLOR
─────
Select the colors in which text is displayed on the screen. Parameters
are foreground and background colors. The format is:
COLOR <foreground color> <background color>
An example:
color 15 1
This will result in white text on a blue background. These are the valid
color codes:
0 = Black
1 = Blue
2 = Green
3 = Cyan
4 = Red
5 = Magenta
6 = Brown
7 = Light gray
8 = Dark gray
9 = Light blue
10 = Light green
11 = Light cyan
12 = Light red
13 = Light magenta
14 = Yellow
15 = White
Note that you can only use the colors 0-7 for background colors. In
order for the COLOR command to work, you must load ANSI.SYS or a
compatible screen driver.
Use the included utility COLORS to see how the different color codes
look on your screen.
DATESTR
───────
Displays the current date on the screen. The format is:
DATESTR <column> <line>
The date is displayed in the format DD.MM.YY, and in the current color.
DELAY
─────
Pauses the execution of the program for the specified number of
seconds. The format is:
DELAY <seconds>
This command, for example, will result in a 5-second pause:
delay 5
The parameter can be in the range 0 to 60 seconds.
ECHO
────
Displays a text string on the screen. Format:
ECHO <text>
The forms ECHO [ON | OFF] are not supported, as Batman never echoes any
commands anyway.
A blank line can be displayed by echoing just a period:
echo .
This is a common method for displaying blank lines, and is implemented
is several DOS versions.
FOR
───
Constructs a loop which allows you to repeat a command for selected
files. The format is:
FOR <variable> IN (<file specification>) DO <command>
An example:
for %%x in (*.txt) do copy %%x lpt1:
This command will print all files with the extension ".TXT" on the
printer.
GOTO / GOSUB / RETURN
─────────────────────
These commands allow you to transfer control to another place in the
batch file. Formats:
GOTO <label>
GOSUB <label>
Such jumps can only be made to lines that contain a "label". This is a
line which starts with a colon, for example:
:label1
Batman distinguishes only between the first 8 characters i label names.
If the jump is made by means of the GOSUB command, you can return to
the following line with the RETURN command. This is not the case when
control is transferred with the GOTO command.
GOSUB commands may be nested:
:start
┌─ gosub label_1
│ return <─┐
└> :label_1 │
┌─ gosub label_2 │
│ echo Label 1 <┐│
│ return ─│┘
└> :label_2 │
echo Label 2 │
return ─┘
You can nest GOSUB commands in 64 levels.
IF
──
Logical condition.